<template>
    <div v-if="visible" class="modal-overlay">
      <div class="modal-content">
        <div class="modal-header">
          <slot name="header">默认标题</slot>
        </div>
        <div class="modal-body">
          <slot>默认内容</slot>
        </div>
        <div class="modal-footer">
          <slot name="footer">默认按钮</slot>
        </div>
      </div>
    </div>
  </template>
   
  <script>
  export default {
    props: {
      visible: {
        type: Boolean,
        required: true
      }
    }
  };
  </script>
   
  <style scoped>
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
  }
   
  .modal-content {
    background-color: #fff;
    margin: 20px;
    padding: 20px;
    max-height: calc(100% - 40px);
    overflow-y: auto;
  }
   
  .modal-header,
  .modal-footer {
    padding: 10px;
    text-align: left;
  }
   
  .modal-body {
    padding: 20px 0;
  }
  </style>